<?php

namespace App\Models;

use Hyn\Tenancy\Traits\UsesTenantConnection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Models\AssetBundleItem
 *
 * @property int $id
 * @property int $asset_bundle_id
 * @property int $bundleable_id
 * @property string $bundleable_type
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \App\Models\AssetBundle $bundle
 * @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $item
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\AssetBundleItem onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem whereAssetBundleId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem whereBundleableId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem whereBundleableType($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\AssetBundleItem whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\AssetBundleItem withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\AssetBundleItem withoutTrashed()
 * @mixin \Eloquent
 */
class AssetBundleItem extends Model
{
    use SoftDeletes, UsesTenantConnection;
    protected $guarded = [];
    protected $with= ["item"];

    public function bundle(){
        return $this->belongsTo(AssetBundle::class, "asset_bundle_id");
    }

    public function item()
    {
        return $this->morphTo("bundleable");
    }
}
